//
//  UIImageView+Extension.swift
//  MM2
//
//  Created by 李成明 on 2022/1/6.
//

import Foundation
import UIKit
import Kingfisher

private let avatarAppendStr = "?x-oss-process=image/quality,Q_50"

extension UIImageView {
    func setImageWithUrlStr(_ str: String?) {
        guard let str = str, let url = URL(string: str) else {
            self.image = placeHolderImg
            return
        }
        self.kf.setImage(with: url, placeholder: placeHolderImg)
    }
    
    func setAvatar(urlStr: String?) {
        guard let urlStr = urlStr, let url = URL(string: urlStr + avatarAppendStr) else {
            self.image = placeHolderImg
            return
        }
        self.kf.setImage(with: url, placeholder: placeHolderImg)
    }
}
